﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace Sprint1.Models
{
    [MetadataType(typeof(StudentMetadata))]
    public partial class Student
    {
    }
    public class StudentMetadata
    {
        public int Id { get; set; }
        [Required]
        [RegularExpression(@"^[a-zA-Z''-'\s]{1,40}$", ErrorMessage = "enter a valid name please ! ")]
        public string Name { get; set; }
        [Required]
        [RegularExpression(@"^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$", ErrorMessage = "not a valid email ! ")]
        public string Email { get; set; }
        [Required]
        [DataType(System.ComponentModel.DataAnnotations.DataType.Password)]
        [RegularExpression(@"(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,10})$", ErrorMessage = "It must be between 8 and 10 characters, contain at least one digit and one alphabetic character, and must not contain special characters.")]
        public string Password { get; set; }
        //Hamed : for Regular expressions http://www.regexr.com/v1/
        //http://msdn.microsoft.com/en-us/library/ff650303.aspx   
        public List<Course> Courses { get; set; }
    }
}